#ifndef AIRCRAFT_H
#define AIRCRAFT_H

#include "mvc/model/configuration.h"
#include "mvc/model/AGeometry.h"

enum _genum{p_ls, p_fuselage, p_htail, p_vtail};

class Aircraft : public Configuration
{
    public:
        Aircraft(int id, Parameters *parameters, Airfoils_curve_map *airfoils);
        virtual ~Aircraft();
        virtual const AGeometry &get_a_geometry(_genum g_index) const;
        virtual QVector<int> get_wings_fuselage_intersection_panels() const;
    protected:
        virtual void generate_reference_curves_index();
        virtual int generate_rc_fuselage_index(int c_index);
        virtual int generate_rc_wings_index(int c_index);
        virtual int generate_rc_htail_index(int c_index);
        virtual int generate_rc_vtail_index(int c_index);
        virtual void generate_reference_curves();
        virtual void generate_fuselage_refcurves(int knpc);
        virtual void create_fcurve(int r_curve_index, double radio, double lenght,
                                   Point fstp, bool to_scale = true);
        virtual void generate_wings_refcurves();
        virtual void calculate_wings_fuselage_intersection(int irc_index, int frc_index,
                                                           int knpc, double diameter);
        virtual void create_wcurve(int index_curve, int nknots, const QString &rcurve,
                                   double wingspan, double scale_value,
                                   double rotate_value, double arrow_angle,
                                   double dihedral_angle, Point3D *locate_point = 0);
        virtual void generate_vertical_tail_refcurves(int knpc);
        virtual void generate_horizontal_tail_refcurves();
        void draw_geometry(int g_index, int knpc, bool with_texture) const;
        void draw_simulation(int step, bool with_texture) const;
        virtual AGeometry *create_fuselage();
        virtual AGeometry *create_wings();
        virtual AGeometry *create_vertical_tail();
        virtual AGeometry *create_horizontal_tail();
    protected:
        QMap<QString, int> reference_curves_map; // used to keep the index of the needed reference curves
        Airfoils_curve_map *_airfoils;  // the the airfoils needed to create the reference curves
        int wf_start_intersection_panel; // the first panel on the wings-fuselage intersection
};

#endif // AIRCRAFT_H
